package org.example.m7_12;

import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Test {
    private static int[][] directions = {{0,1},{1,0},{0,-1},{-1,0}};
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        //int n = in.nextInt();
        //System.out.println(fib(n));
        int n = in.nextInt();
        int[][] t = new int[n][];
        t[0] = new int[1];
        t[0][0] = 1;
        for (int i = 1; i < n; i++) {
            t[i] = new int[i + 1];
            t[i][0] = 1;
            t[i][i] = 1;
            for (int j = 1; j < i; j++) {
                t[i][j] = t[i-1][j-1] + t[i-1][j];
            }
        }
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < i + 1; j++) {
                System.out.print(t[i][j] + " ");
            }
            System.out.println();
        }
    }
    public static boolean exist (String[] board, String word) {
        // write code here
        if (board == null || word == null){
            return false;
        }
        int rows = board.length;
        int cols = board[0].length();
        for (int i = 0; i < rows; i++) {
            for (int j = 0; j < cols; j++) {
                if (dfs(board,word,i,j,0)){
                    return true;
                }
            }
        }
        return false;
    }
    private static boolean dfs(String[] board, String word,int i,int j,int pos){
        if (pos == word.length()){
            return true;
        }
        if (i < 0||i >= board.length || j < 0 || j >= board[0].length()||board[i].charAt(j) != word.charAt(pos)){
            return false;
        }
        //标记字符已访问
        char t = board[i].charAt(j);
        StringBuilder s = new StringBuilder(board[i]);
        s.setCharAt(j,'#');
        board[i] = s.toString();
        //递归
        for (int[] dir : directions) {
            if (dfs(board,word,i+dir[0],j+dir[1],pos+1)){
                return true;
            }
        }
        s.setCharAt(j,t);
        board[i] = s.toString();
        return false;
    }
    public static int fib(int num){
        if (num == 1){
            return 0;
        }
        int fib1 = 0;
        int fib2 = 1;
        int fib = fib1 + fib2;
        while(fib < num){
            fib2 = fib1;
            fib1 = fib;
            fib = fib1 + fib2;
        }
        int n1 = num - fib1;
        int n2 = fib - num;
        return n1 < n2 ? n1 : n2;
    }
}
